package com.wc.codeforces.二进制.A_BIT_of_a_Construction;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/6/14 10:01
 * @description https://codeforces.com/problemset/problem/1957/B
 * 求的是或运算后1的数量最大, 细心一点
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 200010;
    static int[] res = new int[N];
    static int n, k;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextInt();
            k = sc.nextInt();
            if (n == 1) {
                out.print(k);
            } else {
                for (int i = 30; i >= 0; i--) {
                    if (k >= (1 << i) - 1) {
                        res[1] = (1 << i) - 1;
                        k -= (1 << i) - 1;
                        break;
                    }
                }
                for(int i = 2; i < n; i++) res[i] = 0;
                res[n] = k;
                for (int i = 1; i <= n; i++) {
                    out.print(res[i] + " ");
                }
            }
            out.println();
        }
        out.flush();
    }
}


class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
